import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router'
import i18n from './i18n'

const app = createApp(App)
app.use(createPinia())
app.use(router)
app.use(i18n)

// 设置默认语言
const defaultLocale = localStorage.getItem('locale') || 'zh'
i18n.global.locale.value = defaultLocale

// 配置Element Plus语言包
app.use(ElementPlus, {
  locale: defaultLocale === 'zh' ? zhCn : en,
})

app.mount('#app')


